package main.java.collection;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * 演示Arraylist的添加、遍历及修改
 */
public class ListDemo1 {
    public static void main(String[] args) {
        Random rand = new Random();
        List<Integer> l = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            l.add(rand.nextInt(1000));//0-999填入十次随机数
        }
        System.out.println(l);

        for (int i = 0; i < 10; i++) {//需求：每个元素扩大为原来的十倍
            l.set(i,l.get(i)*10);
        }
        System.out.println(l);
    }
}
